<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Ewallet电脑网站支付</title>

    <script th:src="@{/js/jquery.min.js}"></script>

    <link rel="stylesheet" th:href="@{/css/bootstrap.min.css}">
    <link rel="stylesheet" th:href="@{/css/bootstrap-theme.min.css}">
    <script th:src="@{/js/bootstrap.min.js}"></script>
    <style>

        * {
            margin: 0;
            padding: 0;
        }

        ul, ol {
            list-style: none;
        }

        body {
            font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande",
            sans-serif;
            padding-top: 70px;

        }


        .tab-head {
            margin-left: 120px;
            margin-bottom: 10px;
        }

        .tab-content {
            clear: left;
            display: none;
        }

        h2 {
            border-bottom: solid #02aaf1 2px;
            width: 200px;
            height: 25px;
            margin: 0;
            float: left;
            text-align: center;
            font-size: 16px;
        }

        .selected {
            color: #FFFFFF;
            background-color: #02aaf1;
        }

        .show {
            clear: left;
            display: block;
        }

        .hidden {
            display: none;
        }

        .new-btn-login-sp {
            padding: 1px;
            display: inline-block;
            width: 75%;
        }

        .new-btn-login {
            background-color: #02aaf1;
            color: #FFFFFF;
            font-weight: bold;
            border: none;
            width: 100%;
            height: 30px;
            border-radius: 5px;
            font-size: 16px;
        }

        #main {
            width: 100%;
            margin: 0 auto;
            font-size: 14px;
            /*background-color: #faf9f9;*/
        }

        .red-star {
            color: #f00;
            width: 10px;
            display: inline-block;
        }

        .null-star {
            color: #fff;
        }

        .content {
            margin-top: 10px;

        }

        .content dt {
            width: 130px;
            display: inline-block;
            float: left;
            margin-left: 20px;
            color: #666;
            height: 30px;
            font-size: 14px;
            margin-top: 0px;

        }
        .content hr{
            height: 0px;
        }

        .content dd {
            margin-left: 120px;
            margin-bottom: 2px;
        }

        .content dd input {
            width: 85%;
            height: 20px;
            border: 0;
            -webkit-border-radius: 0;
            -webkit-appearance: none;

        }

        #foot {
            margin-top: 10px;
            position: absolute;
            bottom: 15px;
            width: 100%;
        }

        .foot-ul {
            width: 100%;
        }

        .foot-ul li {
            width: 100%;
            text-align: center;
            color: #666;
        }

        .note-help {
            color: #999999;
            font-size: 12px;
            line-height: 130%;
            margin-top: 5px;
            width: 100%;
            display: block;
        }

        #btn-dd {
            margin: 20px;
            text-align: center;
        }

        .foot-ul {
            width: 100%;
        }

        .one_line {
            display: block;
            height: 0px;
            border: 0;
            border-top: solid #eeeeee;
            width: 100%;
            margin-left: 20px;
        }

        .am-header {
            display: -webkit-box;
            display: -ms-flexbox;
            width: 100%;
            position: relative;
            padding: 7px 0;
            -webkit-box-sizing: border-box;
            -ms-box-sizing: border-box;
            box-sizing: border-box;
            background: #1D222D;
            height: 50px;
            text-align: center;
            -webkit-box-pack: center;
            -ms-flex-pack: center;
            box-pack: center;
            -webkit-box-align: center;
            -ms-flex-align: center;
            box-align: center;
        }

        .am-header h1 {
            -webkit-box-flex: 1;
            -ms-flex: 1;
            box-flex: 1;
            line-height: 18px;
            text-align: center;
            font-size: 18px;
            font-weight: 300;
            color: #fff;
        }
        .mainclass{

        }
    </style>

</head>
<body text=#000000 bgColor="#ffffff" leftMargin=0 topMargin=4>

<div>
    <nav class="navbar navbar-default navbar-fixed-top navbar-inverse">
        <div class="container">
            <div class="navbar-header">
                <img alt="Brand" th:src="@{images/logo3.png}">
            </div>
            <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                <ul class="nav navbar-nav">
                    <li><a href="/">首页</a></li>
                    <li><a href="/goodsIndex">网上商城</a></li>
                    <li><a href="/trans">转账</a></li>
                    <li><a href="/settlement">清算</a></li>
                    <li><a href="/withdraw">提现</a></li>
                </ul>
                <ul class="nav navbar-nav navbar-right">
                    <li class="dropdown">
                        <a class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
                            Signed in as <span th:text="${username}"></span><span class="caret" ></span>
                        </a>
                        <ul class="dropdown-menu">
                            <li><a th:href="${'/user/'+username}">用户中心</a></li>
                            <li role="separator" class="divider"></li>
                            <li><a href="/logout">注销</a></li>
                        </ul>
                    </li>
                </ul>
            </div>
        </div>
    </nav>
</div>

<header class="am-header">
    <h1>E-Wallet网站支付体验入口页</h1>
</header>

<div id="main" class="mainclass">
    <div id="tabhead" class="tab-head">
        <h2 id="tab1" class="selected" name="tab">付 款</h2>
        <h2 id="tab2" name="tab">交 易 查 询</h2>
        <h2 id="tab3" name="tab">退 款</h2>
        <h2 id="tab4" name="tab">退 款 查 询</h2>
        <h2 id="tab5" name="tab">交 易 关 闭</h2>
    </div>
    <form name=alipayment action="/addpay" method=post target="_blank">
        <input type="hidden" name="pay_account_id" th:value="${user_id}">
        <input type="hidden" name="pay_type" value="商城付款">
        <input type="hidden" name="pay_target_id" value="2">
        <div id="body1" class="show" name="divcontent">
            <dl class="content">

                <dt>订单名称 ：</dt>
                <dd>
                    <input id="pay_name" name="pay_name" th:value="${title}"   />
                </dd>
                <hr class="one_line">
                <dt>付款金额 ： </dt>
                <dd>
                    <input id="pay_amount" name="pay_amount"   disabled="disabled"  th:value="${price}"/>
                </dd>
                <hr class="one_line">
                <dt>付款方式 ：</dt>
                <dd>
                    <input id="pay_type" name="pay_type" disabled="disabled"  th:value="直接付款"/>
                </dd>
                <hr class="one_line">
                <dt>备注：</dt>
                <dd>
                    <input id="pay_description" name="pay_description" />
                </dd>
                <hr class="one_line">
                <dt></dt>
                <dd>
						<span class="new-btn-login-sp">
							<button class="new-btn-login" type="submit"
                                    style="text-align: center;" id="fk" onclick="disableButton()">付 款</button>
						</span> <span class="note-help">如果您点击“付款”按钮，即表示您同意该次的执行操作。</span>
                </dd>
            </dl>
        </div>
    </form>
    <!--<form name=tradequery action="query" method=post
          target="_blank">-->
    <div id="body2" class="tab-content" name="divcontent">
        <dl class="content">
            <dt>商户订单号 ：</dt>
            <dd>
                <input id="WIDTQout_trade_no" name="WIDTQout_trade_no" />
            </dd>
            <hr class="one_line">
            <dt>E-Wallet交易号 ：</dt>
            <dd>
                <input id="WIDTQtrade_no" name="WIDTQtrade_no" />
            </dd>
            <hr class="one_line">
            <dt></dt>
            <dd id="btn-dd">
						<span class="new-btn-login-sp">
							<button class="new-btn-login" type="submit"
                                    style="text-align: center;"  onclick="jxcx()">交 易 查 询</button>
						</span> <span class="note-help">商户订单号与E-Wallet交易号二选一，如果您点击“交易查询”按钮，即表示您同意该次的执行操作。</span>
            </dd>

            <div id="jxcx"></div>
        </dl>
    </div>
    <!--</form>-->
    <!-- <form name=traderefund action=alipay.trade.refund.jsp method=post
           target="_blank">-->
    <div id="body3" class="tab-content" name="divcontent">
        <dl class="content">
            <dt>商户订单号 ：</dt>
            <dd>
                <input id="WIDTRout_trade_no" name="WIDTRout_trade_no" />
            </dd>
            <hr class="one_line">
            <dt>E-Wallet交易号 ：</dt>
            <dd>
                <input id="WIDTRtrade_no" name="WIDTRtrade_no" />
            </dd>
            <hr class="one_line">
            <dt>退款金额 ：</dt>
            <dd>
                <input id="WIDTRrefund_amount" name="WIDTRrefund_amount" />
            </dd>
            <hr class="one_line">
            <dt>退款原因 ：</dt>
            <dd>
                <input id="WIDTRrefund_reason" name="WIDTRrefund_reason" />
            </dd>
            <hr class="one_line">
            <dt>退款请求号 ：</dt>
            <dd>
                <input id="WIDTRout_request_no" name="WIDTRout_request_no" />
            </dd>
            <hr class="one_line">
            <dt></dt>
            <dd>
						<span class="new-btn-login-sp">
							<button class="new-btn-login" type="submit"
                                    style="text-align: center;" onclick="tk()">退 款</button>
						</span> <span class="note-help">商户订单号与E-Wallet交易号二选一，如果您点击“退款”按钮，即表示您同意该次的执行操作。</span>
            </dd>
            <div id="tk"></div>
        </dl>
    </div>
    <!--</form>-->
    <!-- <form name=traderefundquery
           action=alipay.trade.fastpay.refund.query.jsp method=post
           target="_blank">-->
    <div id="body4" class="tab-content" name="divcontent">
        <dl class="content">
            <dt>商户订单号 ：</dt>
            <dd>
                <input id="WIDRQout_trade_no" name="WIDRQout_trade_no" />
            </dd>
            <hr class="one_line">
            <dt>E-Wallet交易号 ：</dt>
            <dd>
                <input id="WIDRQtrade_no" name="WIDRQtrade_no" />
            </dd>
            <hr class="one_line">
            <dt>退款请求号 ：</dt>
            <dd>
                <input id="WIDRQout_request_no" name="WIDRQout_request_no" />
            </dd>
            <hr class="one_line">
            <dt></dt>
            <dd>
						<span class="new-btn-login-sp">
							<button class="new-btn-login" type="submit"
                                    style="text-align: center;"  onclick="tkcx()">退 款 查 询</button>
						</span> <span class="note-help">商户订单号与E-Wallet交易号二选一，如果您点击“退款查询”按钮，即表示您同意该次的执行操作。</span>
            </dd>

            <div id="tkcx"></div>
        </dl>
    </div>
    <!--</form>-->


    <!-- <form name=tradeclose action=alipay.trade.close.jsp method=post
           target="_blank">-->
    <div id="body5" class="tab-content" name="divcontent">
        <dl class="content">
            <dt>商户订单号 ：</dt>
            <dd>
                <input id="WIDTCout_trade_no" name="WIDTCout_trade_no" />
            </dd>
            <hr class="one_line">
            <dt>E-Wallet交易号 ：</dt>
            <dd>
                <input id="WIDTCtrade_no" name="WIDTCtrade_no" />
            </dd>
            <hr class="one_line">
            <dt></dt>
            <dd>
						<span class="new-btn-login-sp">
							<button class="new-btn-login" type="submit"
                                    style="text-align: center;" onclick="jxgb()">交 易 关 闭</button>
						</span> <span class="note-help">商户订单号与E-Wallet交易号二选一，如果您点击“交易关闭”按钮，即表示您同意该次的执行操作。</span>
            </dd>

            <div id="jxgb"></div>
        </dl>
    </div>
    <!--</form>-->
    <div id="foot">
        <ul class="foot-ul">
            <li>E-Wallet出版</li>
        </ul>
    </div>
</div>
</body>

<script th:src="@{/js/jquery.min.js}"></script>
<script th:src="@{/js/axios.min.js}"></script>
<script th:src="@{/js/vue.min.js}"></script>


<script type="text/javascript">
    var tabs = document.getElementsByName('tab');
    var contents = document.getElementsByName('divcontent');

    (function changeTab(tab) {
        for(var i = 0, len = tabs.length; i < len; i++) {
            tabs[i].onmouseover = showTab;
        }
    })();

    function showTab() {
        for(var i = 0, len = tabs.length; i < len; i++) {
            if(tabs[i] === this) {
                tabs[i].className = 'selected';
                contents[i].className = 'show';
            } else {
                tabs[i].className = '';
                contents[i].className = 'tab-content';
            }
        }
    }

    function GetDateNow() {
        var vNow = new Date();
        var sNow = "";
        sNow += String(vNow.getFullYear());
        sNow += String(vNow.getMonth() + 1);
        sNow += String(vNow.getDate());
        sNow += String(vNow.getHours());
        sNow += String(vNow.getMinutes());
        sNow += String(vNow.getSeconds());
        sNow += String(vNow.getMilliseconds());
        document.getElementById("WIDout_trade_no").value =  sNow;
        document.getElementById("WIDsubject").value = "测试";
        document.getElementById("WIDtotal_amount").value = "0.01";
    }
    GetDateNow();


    function jxcx() {
        var WIDTQout_trade_no=$("#WIDTQout_trade_no").val();
        var WIDTQtrade_no=$("#WIDTQtrade_no").val();

        $.ajax({
            type : 'POST',
            url : '/pay/query',
            data :{"trade_no":WIDTQtrade_no,"out_trade_no":WIDTQout_trade_no},
            dataType : 'json',
            async : false,
            success : function(data) {

                console.log(data);
                $("#jxcx").append("返回结果:"+data.alipay_trade_query_response.msg+"<br/>"+
                    "购买人:"+data.alipay_trade_query_response.buyer_logon_id+"<br/>"
                    +"实际支付金额:"+data.alipay_trade_query_response.total_amount+"<br/>"
                    +"返回状态:"+data.alipay_trade_query_response.trade_status+"<br/>"
                    +"商户订单号："+data.alipay_trade_query_response.out_trade_no+"<br/>"
                    +"E-Wallet交易号:"+data.alipay_trade_query_response.trade_no);
            }
        });
    }

    function disableButton(){
        alert("支付界面初始化中，请关闭该页面")
    }

</script>
</html>